#include <QGuiApplication>
#include <QQmlApplicationEngine>

//内容依据：
//B站： 清晨与猫鱼 QML教程  https://space.bilibili.com/51526943

int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
    QGuiApplication app(argc, argv);//有时候这里报错，就使用QApplication app(argc, argv);

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/30-32.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);

    //加载url的内容进行解析, 实际上走的是Qt安装目录 bin目录下的./qmlscene.exe main.qml
    engine.load(url);

    return app.exec();
}
